<?php
/**
 *  The model for category (catalog tree elements) lists (rather than tree-like structures)
 *  Use the lists functionality from Generic
 */
namespace Dclub\modules\Catalog;

class Model_CategoryList
    extends \Yz\modules\Generic\Model_List
{


    /**
     *  a name of item class (Yz_Item_Interface)
     *  @var string
     */
    protected $itemName = 'Category';


    /************************************
     *      Public methods
     ************************************/



    /** fetch the list of children of the specified category
     *  @param int catId
     *  @return array{item}
     */
    public function fetchCatChildren($catId)
    {
        debug();
        return $this->_fetchListWithAction(
                null,
                'SelectCatChildren',
                function($action) use ($catId)
                {
                    $action->setCatId($catId);

                    // avoid throwing NotFound ex
                    return $action->execute();
                }
            )
        ;
        return $list;
    }

}
